package com.hksj.Intelligentmanagement.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hksj.Intelligentmanagement.common.Result;
import com.hksj.Intelligentmanagement.entity.GasHistoryEntity;
import com.hksj.Intelligentmanagement.mapper.GasHistoryMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @ClassName GasHistoryService
 * @Author zengke
 * @Date 2023/7/18 9:54
 */

@Service
public class GasHistoryService extends ServiceImpl<GasHistoryMapper, GasHistoryEntity> {

    //新增气体历史记录
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public Result createGasHistory(GasHistoryEntity gasHistoryEntity){
        if (this.save(gasHistoryEntity)){
            return Result.ok("新增气体历史记录");
        }
        return Result.error("新增失败");
    }

}
